using IM.Easy.Infrastructure.Query;
using Microsoft.AspNetCore.Mvc;
using IM.Easy.SystemServices.Dtos;
using IM.Easy.SystemServices.IServices;
using IM.Easy.Entity.System;
using IM.Easy.Core.Attributes;

namespace IM.Easy.Api.Controllers.System
{
    /// <summary>
    /// SysUserRoleController 控制器
    /// </summary>
    [Route("system/userRole")]
    public class UserRoleController : ControllerBase
    {
        private readonly IUserRoleService _service;

        /// <summary>
        /// 构造函数，注入服务
        /// </summary>
        /// <param name="service">服务接口</param>
        public UserRoleController(IUserRoleService service)
        {
            _service = service;
        }

        /// <summary>
        /// 保存用户角色
        /// </summary>
        [HttpPost("roles")]
        [Api(Name = "保存用户角色", Perm = "user:role:save")]
        public bool SaveUserRole([FromBody] UserRoleDto dto)
        {
            return _service.SaveUserRoles(dto);
        }
    }
}
